package com.cloudm.technician.ui.modules.scan_qr_code

import android.os.Bundle
import com.cloudm.technician.R
import com.cloudm.technician.extensions.addFragmentToActivity
import com.cloudm.technician.ui.base.BaseActivity

/**
 * 作者: wesley
 * 时间: 2017/12/21
 * 描述: 扫描二维码界面
 */
class ScanQrCodeActivity : BaseActivity() {

    private var flag: Int = 0 //0:扫描车牌号 1:绑定云盒子 2:更换云盒子 3: 车牌号和sn号校验

    override fun handleBundle(bundle: Bundle) {
        flag = bundle.getInt("flag")
    }

    override fun initVariables() {

    }

    override fun initViews(savedInstanceState: Bundle?) {
        headerTitle = when (flag) {
            0, 3 -> R.string.scan_plate_number
            1 -> R.string.bind_cloudm_box
            2 -> R.string.change_cloudm_box
            else -> R.string.scan_qr_code
        }
        displayHomeAsUpEnabled = true
        val fragment = manager.findFragmentById(
                R.id.common_content) as? ScanQrCodeFragment ?: ScanQrCodeFragment.newInstance(flag)
        addFragmentToActivity(manager, fragment)
    }

    override fun initListener() {

    }
}